<template>
  <div
    style="padding-left: 5px;padding-right: 5px;"
    v-if="show"
    v-loading.fullscreen.lock="fullscreenLoading"
    element-loading-customClass="ne-loading"
    element-loading-background="rgba(255, 255, 255, 0.8)"
    :id="component.pageTempStructId"
  >
    <el-row type="flex" justify="space-between">
      <!-- 甲端模板 ------------------------------------------ -->
      <el-col :span="12" class="ppm-box-group">
        <h5 class="ppm-title">甲端</h5>
        <!-- <el-form label-width="100px"> -->
        <el-col>
          <city-selector
            ref="selcity1"
            :span="24"
            :ruleData="ruleData"
            :formData="formData"
            :isSelect="ppmCondition.prodName == 'IPRAN' ? true : false"
            @getPluginValue="citySelectedA"
            :component="{
              attrName: '城市',
              pageTempStructId: '1688',
              attrId: '100010640',
            }"
          />
        </el-col>
        <el-col>
          <el-form-item label="装机地址" prop="1688-100013021.value" :required="formData['1688-100013021'].required.split(',').includes('empty')">
            <el-col :span="12">
              <el-input
                v-model="formData['1688-100013021'].value"
                v-show="formData['1688-100013021'].isshow"
                :disabled="formData['1688-100013021'].disabled"
              />
            </el-col>
            <el-col :span="2">
              <el-button
                @click="selectAddEvent(1)"
                type="primary"
                class="ppm-btn-green"
                >选址</el-button
              >
            </el-col>
          </el-form-item>
        </el-col>
        <el-col>
          <el-form-item label="用户名" prop="1688-100012972.text" :required="formData['1688-100012972'].required.split(',').includes('empty')">
            <input-grid
              v-model="formData['1688-100012972'].text"
              :formData="formData"
              :formKey="'1688-100012972'"
             :component="{
                editable: true,
                pageTempStructId:'1688',
                attrId:'100012972'
              }"
              v-show="formData['1688-100012972'].isshow"
              sqlCode="findCust"
              @inputText="inputTextA"
              @getrow="
                (val) => {
                  formData['1688-100012972'].value = val;
                }
              "
            />
          </el-form-item>
        </el-col>
        <el-col>
          <el-form-item label="联系人" prop="1688-100012975.value" :required="formData['1688-100012975'].required.split(',').includes('empty')">
            <el-input
              v-model="formData['1688-100012975'].value"
              :disableds="formData['1688-100012975'].disabled"
              v-show="formData['1688-100012975'].isshow"
            />
          </el-form-item>
        </el-col>
        <el-col>
          <el-form-item label="联系电话" prop="1688-100012981.value" :required="formData['1688-100012981'].required.split(',').includes('empty')">
            <el-input v-model="formData['1688-100012981'].value" />
          </el-form-item>
        </el-col>

        <el-col>
          <el-form-item label="运营商" id="2079-100010765" prop="2079-100010765.value" :required="formData['2079-100010765'].required.split(',').includes('empty')">
            <sct-select
              v-if="ppmCondition.prodName == 'IPRAN' ? false : true"
              v-model="formData['2079-100010765'].value"
              :productId="productId"
              :attrId="formData['2079-100010765'].id"
              :formData="formData"
              :formKey="'2079-100010765'"
              :disableds="formData['2079-100010765'].disabled"
            ></sct-select>
            <el-radio-group v-model="formData['2079-100010765'].value" v-else>
              <el-radio-button label="10000">中国电信</el-radio-button>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col>
          <el-form-item label="端口类型" prop="2079-100013204.value" :required="formData['2079-100013204'].required.split(',').includes('empty')">
            <sct-select
              v-model="formData['2079-100013204'].value"
              :productId="productId"
              :attrId="formData['2079-100013204'].id"
              :formData="formData"
              :formKey="'2079-100013204'"
              :disabled="formData['2079-100013204'].disabled"
            ></sct-select>
          </el-form-item>
        </el-col>
        <!-- <el-col> -->
        <template
          v-if="formData['2079-100013204'] && formData['2079-100013204']"
        >
          <el-col
            v-show="
              formData['2079-100013204'].value == '80050062014' ||
              formData['2079-100013204'].value == '80050062009'
            "
          >
            <el-form-item label="工作模式" prop="10459175-141000174.value" :required="formData['10459175-141000174'].required.split(',').includes('empty')">
              <dyn-btngroup
                v-model="formData['10459175-141000174'].value"
                :productId="productId"
                :attrId="formData['10459175-141000174'].id"
                :formData="formData"
                :formKey="'10459175-141000174'"
                :disableds="formData['10459175-141000174'].disabled"
              ></dyn-btngroup>
            </el-form-item>
          </el-col>
        </template>
        <!-- <el-col> -->
        <!-- 是否IDC机房专线 && 专线类型 该业务待梳理-->
        <!-- <template
          v-if="
            formData['10460287-142002498'] &&
            formData['10460287-142002498'] &&
            formData['10460287-100012631']
          "
        >
          <el-col
            v-show="
              (formData['10460287-142002498'].value == '2468003' ||
                formData['10460287-142002498'].value == '2468002') &&
              formData['10460287-100012631'].value == '1'
            "
          >
            <el-form-item label="甲端机房编码">
              <input-grid
                v-model="formData['1686-142002499'].text"
                sqlCode="findIDCRoomInfo"
                @getrow="
                  (val) => {
                    formData['1686-142002499'].value = val;
                  }
                "
              />
            </el-form-item>
          </el-col>
        </template> -->
        <!-- <el-col>
					<el-form-item label="CE-VLAN ID">
						<el-col :span="16">
							<el-input v-model="formData['10459175-141000150'].value" />
						</el-col>
					</el-form-item>
				</el-col> -->
        <!-- <template v-if="formData['TD_V_2076-100001004']">
					<el-col v-show="formData['TD_V_2076-100001004'].value == '88800130002'">
						<el-form-item label="是否为聚焦主点">
							<dyn-btngroup v-model="formData['10459175-100014043'].value" :productId="productId" :attrId="formData['10459175-100014043'].id"></dyn-btngroup>
						</el-form-item>
					</el-col>
				</template> -->
        <!-- <el-col> -->
        <!-- formData无对应key,待确认 -->

        <!-- <el-col> -->
        <!-- formData无对应key,待确认 -->
        <!-- <template v-if="formData['TD_V_2076-100001004']">
					<el-col v-show="formData['TD_V_2076-100001004'].value == '88800130002'">
						<el-form-item label="VLAN透传">
							<dyn-btngroup v-model="formData['10459175-141000146'].value" :productId="productId" :attrId="formData['10459175-141000146'].id"></dyn-btngroup>
						</el-form-item>
					</el-col>
				</template>
				<template v-if="formData['TD_V_2076-100001004']"> -->
        <!-- <el-col> -->
        <!-- formData无对应key,待确认 -->
        <!-- <el-col v-show="formData['TD_V_2076-100001004'].value == '88800130002'">
						<el-form-item label="QINQ">
							<el-col :span="16">
								<el-input v-model="formData['10459175-141000152'].value" />
							</el-col>
						</el-form-item>
					</el-col> -->
        <!-- </template> -->

        <!-- <template v-if="formData['10459175-100014043'] && formData['10460287-100001004']">
					<el-col v-show="formData['10459175-100014043'].value == '1' && formData['10460287-100001004'].value == '88800130002'">
						<el-form-item label="S-VLAN ID">
							<el-col :span="11">
								<el-input v-model="formData['10459175-141000148'].value" />
							</el-col>
							<el-col :span="3">
								<el-tooltip class="item" effect="dark" content="1518<=MTU数值<=9600的整数" placement="right">
									<el-button icon="el-icon-question" class="ppm-icon-question"></el-button>
								</el-tooltip>
							</el-col>
						</el-form-item>
					</el-col>
				</template> -->

        <!-- <template v-if="formData['10459175-100014043'] != undefined && formData['10460287-100001004'] != undefined">
					<el-col :span="24" class="line" v-show="formData['10459175-100014043'].value == '1' && formData['10460287-100001004'].value == '88800130002'">
						<div class="grid-content bg-purple">
							<el-form-item label="参考电路接入号类型">
								<el-radio-group v-model="formData['10459175-100013935'].value">
									<el-radio-button v-for="item in formData['10459175-100013935'].options" :key="item.attrValue" :label="item.attrValue">{{ item.attrValueName }}</el-radio-button>
								</el-radio-group>
							</el-form-item>
						</div>
					</el-col>
				</template>
				<template v-if="formData['10459175-100014043'] != undefined && formData['10460287-100001004'] != undefined">
					<el-col :span="24" class="line" v-show="formData['10459175-100014043'].value == '1' && formData['10460287-100001004'].value == '88800130002'">
						<div class="grid-content bg-purple">
							<el-form-item label="参考电路接入号">
								<el-input v-model="formData['10459175-100013936'].value" />
							</el-form-item>
						</div>
					</el-col>
				</template> -->

        <!-- <template v-if="formData['10459175-100014043'] && formData['10460287-100001004']">
					<el-col :span="24" class="line" v-show="formData['10459175-100014043'].value == '1' && formData['10460287-100001004'].value == '88800130002'">
						<div class="grid-content bg-purple">
							<el-form-item label="汇聚组号">
								<el-input v-model="formData['10459175-142002908'].value" />
							</el-form-item>
						</div>
					</el-col>
				</template> -->
        <!-- </el-form> -->
      </el-col>
      <!-- 乙端模板------------------------------------------ -->
      <el-col :span="12" class="ppm-box-group" style="margin-left: 20px">
        <h5 class="ppm-title">乙端</h5>
        <!-- <el-form label-width="100px"> -->
        <el-col>
          <city-selector
            ref="selcity2"
            :span="24"
            :ruleData="ruleData"
            :formData="formData"
            :isSelect="ppmCondition.prodName == 'IPRAN' ? true : false"
            @getPluginValue="citySelectedB"
            :component="{
              attrName: '城市',
              pageTempStructId: '1689',
              attrId: '100010640',
            }"
          />
        </el-col>
        <el-col>
          <el-form-item label="装机地址" prop="1689-100013021.value" :required="formData['1689-100013021'].required.split(',').includes('empty')">
            <el-col :span="12">
              <el-input
                v-model="formData['1689-100013021'].value"
                v-show="formData['1689-100013021'].isshow"
                :disabled="formData['1689-100013021'].disabled"
              />
            </el-col>
            <el-col :span="2">
              <el-button
                @click="selectAddEvent(2)"
                type="primary"
                class="ppm-btn-orange"
                >选址</el-button
              >
            </el-col>
          </el-form-item>
        </el-col>
        <el-col>
          <el-form-item label="用户名" prop="1689-100012972.text" :required="formData['1689-100012972'].required.split(',').includes('empty')">
            <input-grid
              v-model="formData['1689-100012972'].text"
              sqlCode="findCust"
              :component="{
                editable: true,
                pageTempStructId:'1689',
                attrId:'100012972'
              }"
              :formData="formData"
              :formKey="'1689-100012972'"
              v-show="formData['1689-100012972'].isshow"
              @inputText="inputTextB"
              @getrow="
                (val) => {
                  formData['1689-100012972'].value = val;
                }
              "
            />
          </el-form-item>
        </el-col>
        <el-col>
          <el-form-item label="联系人" prop="1689-100012975.value" :required="formData['1689-100012975'].required.split(',').includes('empty')">
            <el-input v-model="formData['1689-100012975'].value" />
          </el-form-item>
        </el-col>
        <el-col>
          <el-form-item label="联系电话" prop="1689-100012981.value" :required="formData['1689-100012981'].required.split(',').includes('empty')">
            <el-input v-model="formData['1689-100012981'].value" />
          </el-form-item>
        </el-col>
        <el-col>
          <el-form-item label="运营商" id="2080-100010765" prop="2080-100010765.value" :required="formData['2080-100010765'].required.split(',').includes('empty')">
            <sct-select
              v-if="ppmCondition.prodName == 'IPRAN' ? false : true"
              v-model="formData['2080-100010765'].value"
              :productId="productId"
              :attrId="formData['2080-100010765'].id"
              :formData="formData"
              :formKey="'2080-100010765'"
              :disableds="formData['2080-100010765'].disabled"
            ></sct-select>
            <el-radio-group v-model="formData['2080-100010765'].value" v-else>
              <el-radio-button label="10000">中国电信</el-radio-button>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col>
          <el-form-item label="端口类型" prop="2080-100013204.value">
            <sct-select
              v-model="formData['2080-100013204'].value"
              :productId="productId"
              :attrId="formData['2080-100013204'].id"
              :formData="formData"
              :formKey="'2080-100013204'"
              :disableds="formData['2080-100013204'].disabled"
            ></sct-select>
          </el-form-item>
        </el-col>
        <template
          v-if="
            formData['2080-100013204'] != undefined &&
            formData['2080-100013204'] != undefined
          "
        >
          <el-col
            v-show="
              formData['2080-100013204'].value == '80050062014' ||
              formData['2080-100013204'].value == '80050062009'
            "
          >
            <!-- 这里是一个动态增减校验规则的写法:当该元素显示时,去匹配对应的校验规则,否则置为空值 -->
            <el-form-item
              label="工作模式"
              :prop="
                formData['2080-100013204'].value == '80050062014' ||
                formData['2080-100013204'].value == '80050062009'
                  ? '10459176-141000174.value'
                  : ''
              "
            >
              <dyn-btngroup
                v-model="formData['10459176-141000174'].value"
                :productId="productId"
                :attrId="formData['10459176-141000174'].id"
                :formData="formData"
                :formKey="'10459176-141000174'"
                :disableds="formData['10459176-141000174'].disabled"
              ></dyn-btngroup>
            </el-form-item>
          </el-col>
        </template>

        <!-- <el-col> -->
        <!-- <template
          v-if="
            formData['10460287-142002498'] != undefined &&
            formData['10460287-142002498'] != undefined &&
            formData['10460287-100012631'] != undefined
          "
        >
          <el-col
            v-show="
              (formData['10460287-142002498'].value == '2468003' ||
                formData['10460287-142002498'].value == '2468002') &&
              formData['10460287-100012631'].value == '1'
            "
          >
            <el-form-item label="乙端机房编码">
              <input-grid
                v-model="formData['1686-100011034'].text"
                sqlCode="findIDCRoomInfo"
                @getrow="
                  (val) => {
                    formData['1686-100011034'].value = val;
                  }
                "
              />
            </el-form-item>
          </el-col>
        </template> -->

        <!-- <el-col>
					<el-form-item label="CE-VLAN ID">
						<el-col :span="16">
							<el-input v-model="formData['10459176-141000150'].value" />
						</el-col>
					</el-form-item>
				</el-col> -->
        <!-- <template v-if="formData['10460287-100001004'] != undefined">
					<el-col v-show="formData['10460287-100001004'].value == '88800130002'">
						<el-form-item label="是否为聚焦主点">
							<dyn-btngroup v-model="formData['10459176-100014043'].value" :productId="productId" :attrId="formData['10459176-100014043'].id"></dyn-btngroup>
						</el-form-item>
					</el-col>
				</template>

				<template v-if="formData['10460287-100001004']">
					<el-col v-show="formData['10460287-100001004'].value == '88800130002'">
						<el-form-item label="VLAN透传">
							<dyn-btngroup v-model="formData['10459176-141000146'].value" :productId="productId" :attrId="formData['10459176-141000146'].id"></dyn-btngroup>
						</el-form-item>
					</el-col>
				</template>
				<template v-if="formData['10460287-100001004']">
					<el-col v-show="formData['10460287-100001004'].value == '88800130002'">
						<el-form-item label="QINQ">
							<el-col :span="16">
								<el-input v-model="formData['10459176-141000152'].value" />
							</el-col>
						</el-form-item>
					</el-col>
				</template>
				<template v-if="formData['10459175-100014043'] != undefined">
					<el-col v-show="formData['10459175-100014043'].value == '1' && formData['10460287-100001004'].value == '88800130002'">
						<el-form-item label="S-VLAN ID">
							<el-col :span="11">
								<el-input v-model="formData['10459176-141000148'].value" />
							</el-col>
							<el-col :span="3">
								<el-tooltip class="item" effect="dark" content="1518<=MTU数值<=9600的整数" placement="right">
									<el-button icon="el-icon-question" class="ppm-icon-question"></el-button>
								</el-tooltip>
							</el-col>
						</el-form-item>
					</el-col>
				</template>
				<template v-if="formData['10459175-100014043'] && formData['10460287-100001004']">
					<el-col :span="24" class="line" v-show="formData['10459175-100014043'].value == '1' && formData['10460287-100001004'].value == '88800130002'">
						<div class="grid-content bg-purple">
							<el-form-item label="参考电路接入号类型">
								<el-radio-group v-model="formData['10459176-100013935'].value">
									<el-radio-button v-for="item in formData['10459176-100013935'].options" :key="item.attrValue" :label="item.attrValue">{{ item.attrValueName }}</el-radio-button>
								</el-radio-group>
							</el-form-item>
						</div>
					</el-col>
				</template>
				<template v-if="formData['10459175-100014043'] != undefined && formData['10460287-100001004'] != undefined">
					<el-col :span="24" class="line" v-show="formData['10459175-100014043'].value == '1' && formData['10460287-100001004'].value == '88800130002'">
						<div class="grid-content bg-purple">
							<el-form-item label="参考电路接入号">
								<el-input v-model="formData['10459176-100013936'].value" />
							</el-form-item>
						</div>
					</el-col>
				</template>
				<template v-if="formData['10459175-100014043'] != undefined && formData['10460287-100001004'] != undefined">
					<el-col :span="24" class="line" v-show="formData['10459175-100014043'].value == '1' && formData['10460287-100001004'].value == '88800130002'">
						<div class="grid-content bg-purple">
							<el-form-item label="汇聚组号">
								<el-input v-model="formData['10459176-142002908'].value" />
							</el-form-item>
						</div>
					</el-col>
				</template> -->

        <!-- </el-form> -->
      </el-col>
    </el-row>
    <el-dialog
      class="ne-pending-task"
      append-to-body
      width="98vw"
      height="96vh"
      top="2vh"
      title="选址"
      v-if="pendItemVisible"
      :visible.sync="pendItemVisible"
      :close-on-click-modal="false"
    >
      <select-address
        @selValueFun="selValueFun"
        :show.sync="pendItemVisible"
        :saParams="saParams"
      ></select-address>
    </el-dialog>
  </div>
</template>

<script>
import config from "./config";
import ruler from "./rules";
import mixinstype20 from "../../commons/mixins/mixinstype20";
import { mapState } from "vuex";
import service from "../../utils/service";
import CustOrderService from "@/api/order/CustOrderService";
import SelectAddress from "./SelectAddress";
import { JSEncrypt } from "jsencrypt";
import {deepAssign,deepClone} from '../../utils/clone'
export default {
  name: "AToB",
  mixins: [mixinstype20],
  created() {
    this.ppmCondition = JSON.parse(sessionStorage.getItem("ppmCondition"));
    this.productId = JSON.parse(sessionStorage.getItem("ppmCondition"))
      ? JSON.parse(sessionStorage.getItem("ppmCondition")).productId
      : "80007004";
    // *注意:写插件时,一定要把config对象 响应化
    deepAssign(this.formData, this.config);
    Object.assign(this.ruleData.rules, this.ruler);
    this.show = true;
    //甲乙端用户名默认
    this.formData["1688-100012972"].text = this.orderPosInfo.custName;
    this.formData["1688-100012972"].value = this.orderPosInfo.custId;
    this.formData["1689-100012972"].text = this.orderPosInfo.custName;
    this.formData["1689-100012972"].value = this.orderPosInfo.custId;
  },
  computed: {
    ...mapState("orders", ["orderPosInfo"]),
    ...mapState("user", ["user"]),
  },
  data() {
    return {
      fullscreenLoading: false,
      secretKey:
        "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCuRmReTzsDwnrGsVkPxnAbeMFpABstpoBtof4fwu0TChN988MLuMEWZDN9cxdSkI9QGH7HPFsvtnClXsjWdJeeBBavBEoiOI7r5re70rc7PdnRbAlVAFAaSHFz5Nc6SYwqqmWvXkhzDxWexMOByI8rBiRNc6gB/JUq3KtdxU3PiQIDAQAB",
      saParams: null,
      pendItemVisible: false,
      config: deepClone(config),
      ruler: ruler,
      show: false,
      ppmCondition: {}, //缓存取得数据
      productId: "",
    };
  },
  components: {
    SelectAddress,
  },
  methods: {
    citySelectedA(val) {
      sessionStorage.setItem("citySelectA", JSON.stringify(val));
      this.$emit("getPluginValue", { address: val, key: "1688-100010640" });
    },
    citySelectedB(val) {
      sessionStorage.setItem("citySelectB", JSON.stringify(val));
      this.$emit("getPluginValue", { address: val, key: "1689-100010640" });
    },
    async selectAddEvent(dk) {
      this.fullscreenLoading = true;
      const result = await service.applyDcoosToken({
        sysUserId: this.user.sysUserId,
        orgId: this.user.orgId,
        prodId: this.ppmCondition.productId,
        scopFlag: 1,
      });
      // const result = {
      //   code: 200,
      //   msg: "OK",
      //   count: 0,
      //   meta: {
      //       "resultCode": 0,
      //       "prodNbr": "35103010001000000002",
      //       "systemUserInfo": {
      //         "statusDate": "20190116025944",
      //         "SHORTCUT_TYPE_6": "6",
      //         "deptName": null,
      //         "SHORTCUT_TYPE_5": "5",
      //         "SHORTCUT_TYPE_4": "4",
      //         "LOGIN_VALID_PHONE": 1,
      //         "departmentId": 1949942,
      //         "systemRoles": null,
      //         "indexCode": null,
      //         "SHORTCUT_TYPE_3": "3",
      //         "SHORTCUT_TYPE_2": "2",
      //         "checkResult": null,
      //         "SHORTCUT_TYPE_1": "1",
      //         "eMail": "liuxy@bjtelecom.net",
      //         "partyIds": null,
      //         "password": null,
      //         "partyId": 3438763,
      //         "certNum": "612301198206172786",
      //         "isIotStaff": null,
      //         "pwdStatusList": null,
      //         "sysPostName": null,
      //         "staffCode": "liuxinyu",
      //         "postInfoJson": null,
      //         "remaiks": null,
      //         "dOrgId": null,
      //         "inductionEndTime": "20991231235959",
      //         "postCertification": null,
      //         "pwdStatus": null,
      //         "deptManagerId": null,
      //         "systemRoleIds": null,
      //         "mobilePhone": "13370163638",
      //         "hrImage": null,
      //         "updateDate": "20210706191205",
      //         "markId": null,
      //         "privilegeJson": null,
      //         "orgLevel": null,
      //         "isBatch": null,
      //         "LOGIN_VALID_NO": 0,
      //         "isDown": "0",
      //         "orgId": 1944664,
      //         "isQueryAddr": null,
      //         "privilegeCode": null,
      //         "postIds": null,
      //         "staffName": "贾燕",
      //         "sortNum": null,
      //         "startTime": null,
      //         "sysUserId": 102533,
      //         "inductionStartTime": null,
      //         "staffOrgRels": null,
      //         "salesstaffCode": null,
      //         "loginValid": 1,
      //         "createDate": "20080405032105",
      //         "staffDesc": null,
      //         "CERT_VALID_NO": "1",
      //         "unStaffId": null,
      //         "conPwd": null,
      //         "sysPostId": null,
      //         "staffAccount": "liuxinyu",
      //         "pwdStatusName": null,
      //         "statusCd": "1000",
      //         "notStaffIds": null,
      //         "updateStaffName": null,
      //         "staffIds": null,
      //         "endTime": null,
      //         "checkId": null,
      //         "unSysPostCode": null,
      //         "certType": "1",
      //         "statusCdName": null,
      //         "sysUserIds": null,
      //         "createStaffName": null,
      //         "statusMap": {
      //           "CERT_VALID_0": "免认证",
      //           "CERT_VALID_1": "未认证",
      //           "CERT_VALID_2": "认证成功",
      //           "STAFF_STATUS_CD_1300": "注销",
      //           "CERT_VALID_3": "认证失败",
      //           "STAFF_STATUS_CD_1200": "停用",
      //           "STAFF_STATUS_CD_1100": "删除",
      //           "STAFF_STATUS_CD_1000": "在岗",
      //           "PWD_STATUS_1000": "正常 ",
      //           "PWD_STATUS_1100": "初始化密码",
      //           "PWD_STATUS_1200": "90天未修改密码冻结",
      //           "PWD_STATUS_1300": "密码输出5次错误冻结"
      //         },
      //         "CERT_VALID_SUCCESS": "2",
      //         "fileIds": null,
      //         "reg": null,
      //         "certValid": "0",
      //         "orgName": null,
      //         "STAFF_TYPE_3": "3",
      //         "privilegeIds": null,
      //         "STAFF_TYPE_1": "1",
      //         "createStaff": null,
      //         "CERT_VALID_NOUSE": "0",
      //         "commonRegionId": null,
      //         "operGroupIds": null,
      //         "sysPostCode": null,
      //         "deptPostMap": null,
      //         "position": null,
      //         "hrUserCode": null,
      //         "updateStaff": 1,
      //         "certValidName": null,
      //         "unStatusCd": null,
      //         "systemRoleJson": null,
      //         "inductionPostType": null,
      //         "hrPersonid": "11000411@BJ",
      //         "orgPostMap": null,
      //         "orderNum": null,
      //         "sjqxJson": null,
      //         "batchId": "5910",
      //         "orgIds": null,
      //         "checkResultDesc": null,
      //         "CERT_VALID_FAIL": "3",
      //         "ifyizhan": null,
      //         "provinceCode": "8110100",
      //         "shortcutType": null,
      //         "lastCertValidTime": "20210727173344",
      //         "staffType": "1",
      //         "isNotSelectMobilePhone": false,
      //         "LOGIN_VALID_EMAIL": 2,
      //         "sortType": null,
      //         "chanStaffCode": null,
      //         "STAFF_STATUS_CD_3": "1300",
      //         "STAFF_STATUS_CD_2": "1200",
      //         "STAFF_STATUS_CD_1": "1100",
      //         "STAFF_STATUS_CD_0": "1000",
      //         "staffId": 100078
      //       },
      //       "resultMsg": "获取token成功",
      //       "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwYXNzd29yZCI6IkR5ZnVVQWlhTXFtdldDL0RSSHJsUE9ib1V4T1c0VXNKRXhwK3Z2MUt5ZDAvQkF0YVJiTUFhQmFISFp3SEpjWkFWUkMrclFsNHl3WWpBZFhSazNvaFRSaVBQaG50Z0lvbHBPUWJ6a1k2Z2pTSXN4MkRCMUprZExkbXRubjFZdDhHd2h3dEJvS1BxbWozZ3VmcmgzcGdmLzZMdE5EZjY3YThVMHJmYWFtQ2tmMD0iLCJleHAiOjE2MjYzNTA3MzksInVzZXJuYW1lIjoiY3JtIn0.m9Y1Q1i6lNCGZUzBbJokWsoxOxU2oW3oxKZ5dpCUsG4",
      //   },
      // };
      if (result.meta) {
        if (~~result.meta.resultCode == 0) {
          let userInfo = {
            userName: result.meta.systemUserInfo.staffName,
            contact: result.meta.systemUserInfo.staffName,
            telephone: result.meta.systemUserInfo.mobilePhone,
            email: result.meta.systemUserInfo.eMail,
          };
          this.saParams = {
            token: encodeURIComponent(result.meta.token),
            addressNum: 1,
            productCode: result.meta.prodNbr,
            dk: dk,
          };

          // this.saParams.userInfo = encodeURI(this.getRsaCode(userInfo, this.secretKey), "utf-8");
          this.saParams.userInfo = encodeURIComponent(
            this.getRsaCode(userInfo, this.secretKey)
          );

          this.fullscreenLoading = false;
          this.pendItemVisible = true;
        } else {
          this.$message({
            showClose: true,
            message: result.meta.resultMsg,
            type: "error",
          });
        }
      } else {
        this.fullscreenLoading = false;
        this.$message({
          showClose: true,
          message: result.meta.logMap.stackTrace,
          type: "error",
        });
      }
    },
    async selValueFun(arg) {
      let dkNum = "",
        prodName = "",
        addressList = arg.addressesList[0];
      if (arg.dk == 1) {
        // 甲端
        dkNum = "1688";
      } else if (arg.dk == 2) {
        // 乙端
        dkNum = "1689";
      }
      this.formData[dkNum + "-100013021"].value = addressList.fullName;
      let ppmCondition = JSON.parse(sessionStorage.getItem("ppmCondition"));
      if (ppmCondition.prodName == "MSTP") {
        if (arg.dk == 1) {
          prodName = "10461239";
        } else if (arg.dk == 2) {
          prodName = "10461240";
        }
      } else if (ppmCondition.prodName == "SDH") {
        if (arg.dk == 1) {
          prodName = "10461242";
        } else if (arg.dk == 2) {
          prodName = "10461243";
        }
      } else if (ppmCondition.prodName == "IPRAN") {
        if (arg.dk == 1) {
          prodName = "10461245";
        } else if (arg.dk == 2) {
          prodName = "10461246";
        }
      }

      this.formData[prodName + "-142002230"].value = addressList.fullName;
      this.formData[prodName + "-142002231"].value = addressList.provinceId;
      this.formData[prodName + "-142002232"].value = addressList.cityId;
      this.formData[prodName + "-142002233"].value = addressList.longitude;
      this.formData[prodName + "-142002234"].value = addressList.latitude;
      this.formData[prodName + "-142002308"].value = addressList.id;
      this.formData[prodName + "-142002958"].value = addressList.areaId;
      this.formData[prodName + "-142002959"].value = addressList.capability;
      this.formData[prodName + "-142002960"].value = addressList.capabilityUrl;
      let params = {
        interFaceType: "ORDER",
        sqlId: 2021071602,
      };
      let presult = null,
        cresult = null,
        aresult = null,
        address = {
          country: "26068",
        },
        someArr1 = ["8120000", "8500000"], // 天津,重庆
        someArr2 = ["8310000"]; // 上海,
      if (
        someArr1.some((item, index, array) => {
          return Number(item) == Number(addressList.provinceId);
        })
      ) {
        presult = await CustOrderService.getExecuteSqlList({
          paramStr: "regionNbr:" + addressList.provinceId,
          ...params,
        });
        aresult = await CustOrderService.getExecuteSqlList({
          paramStr: "regionNbr:" + addressList.areaId,
          ...params,
        });
        address = {
          provice: presult.meta.resList.executeSqlResps[0].LocId,
          city: aresult.meta.resList.executeSqlResps[0].LocId,
          ...address,
        };
        this.$refs["selcity" + arg.dk].selectProvice(address.provice);
        this.$refs["selcity" + arg.dk].selectCity(address.city);
        this.$refs["selcity" + arg.dk].address.city = Number(address.city);
        this.$refs["selcity" + arg.dk].address.provice = Number(
          address.provice
        );
        this.$refs["selcity" + arg.dk].address.area = "";
      } else if (
        someArr2.some((item, index, array) => {
          return Number(item) == Number(addressList.provinceId);
        })
      ) {
        cresult = await CustOrderService.getExecuteSqlList({
          paramStr: "regionNbr:" + addressList.cityId,
          ...params,
        });
        aresult = await CustOrderService.getExecuteSqlList({
          paramStr: "regionNbr:" + addressList.areaId,
          ...params,
        });
        address = {
          provice: cresult.meta.resList.executeSqlResps[0].LocId,
          city: aresult.meta.resList.executeSqlResps[0].LocId,
          ...address,
        };
        this.$refs["selcity" + arg.dk].selectProvice(address.provice);
        this.$refs["selcity" + arg.dk].selectCity(address.city);
        this.$refs["selcity" + arg.dk].address.city = Number(address.city);
        this.$refs["selcity" + arg.dk].address.provice = Number(
          address.provice
        );
        this.$refs["selcity" + arg.dk].address.area = "";
      } else if (addressList.provinceId == "8110000") {
        // 北京
        cresult = await CustOrderService.getExecuteSqlList({
          paramStr: "regionNbr:" + addressList.cityId,
          ...params,
        });
        address = {
          provice: cresult.meta.resList.executeSqlResps[0].LocId,
          ...address,
        };
        this.$refs["selcity" + arg.dk].address.provice = Number(
          address.provice
        );
        this.$refs["selcity" + arg.dk].address.city = "";
        this.$refs["selcity" + arg.dk].address.area = "";
      } else {
        presult = await CustOrderService.getExecuteSqlList({
          paramStr: "regionNbr:" + addressList.provinceId,
          ...params,
        });
        cresult = await CustOrderService.getExecuteSqlList({
          paramStr: "regionNbr:" + addressList.cityId,
          ...params,
        });
        aresult = await CustOrderService.getExecuteSqlList({
          paramStr: "regionNbr:" + addressList.areaId,
          ...params,
        });
        address = {
          provice: presult.meta.resList.executeSqlResps[0].LocId,
          city: cresult.meta.resList.executeSqlResps[0].LocId,
          area: aresult.meta.resList.executeSqlResps[0].LocId,
          ...address,
        };
        this.$refs["selcity" + arg.dk].selectProvice(address.provice);
        this.$refs["selcity" + arg.dk].selectCity(address.city);
        this.$refs["selcity" + arg.dk].address.city = Number(address.city);
        this.$refs["selcity" + arg.dk].address.area = Number(address.area);
        this.$refs["selcity" + arg.dk].address.provice = Number(
          address.provice
        );
      }
      this.$refs["selcity" + arg.dk].selectArea();
    },
    getRsaCode(code, key) {
      let encrypt = new JSEncrypt();
      encrypt.setPublicKey(
        "-----BEGIN PUBLIC KEY-----" + key + "-----END PUBLIC KEY-----"
      );
      let data = encrypt.encrypt(JSON.stringify(code));
      return data;
    },
    //创建用户名事件
    async inputTextA(val) {
      if (val == "") return;
      let result = await CustOrderService.qryAZCustId({ custName: val });
      if (result.code == 200) {
        if (result.meta.resultCode == 0) {
          this.formData["1688-100012972"].text = val;
          this.formData["1688-100012972"].value = result.meta.custId;
        } else {
          this.formData["1688-100012972"].text = "";
          this.formData["1688-100012972"].value = "";
          this.$alert("创建甲乙端客户失败", "提示", { type: "warning" });
        }
      }
    },
    async inputTextB(val) {
      if (val == "") return;
      let result = await CustOrderService.qryAZCustId({ custName: val });
      if (result.code == 200) {
        if (result.meta.resultCode == 0) {
          this.formData["1689-100012972"].text = val;
          this.formData["1689-100012972"].value = result.meta.custId;
        } else {
          this.formData["1689-100012972"].text = "";
          this.formData["1689-100012972"].value = "";
          this.$alert("创建甲乙端客户失败", "提示", { type: "warning" });
        }
      }
    },
  },
};
</script>
